package com.insthub.ecmobile.activity; // // __ // /\ \ _ // ____ ____ ___\ \ \_/ \ _____ ___ ___ // / _ \ / __ \ / __ \ \ < __ /\__ \ / __ \ / __ \ // /\ \_\ \/\ __//\ __/\ \ \\ \ /\_\ \/_/ / /\ \_\ \/\ \_\ \ // \ \____ \ \____\ \____\\ \_\\_\ \/_/ /\____\\ \____/\ \____/ // \/____\ \/____/\/____/ \/_//_/ \/____/ \/___/ \/___/ // /\____/ // \/___/ // // Powered by BeeFramework // import android.app.Activity; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ImageView; import android.widget.TextView; import com.insthub.BeeFramework.activity.BaseActivity; import com.insthub.ecmobile.R; import com.umeng.analytics.MobclickAgent; public class BannerWebActivity extends BaseActivity { private TextView title; private ImageView back; private WebView webView; private ImageView web_back; private ImageView goForward; private ImageView reload; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.pay_web); Intent intent = getIntent(); String url = intent.getStringExtra("url"); title = (TextView) findViewById(R.id.top_view_text); Resources resource = (Resources) getBaseContext().getResources(); String bro=resource.getString(R.string.browser); title.setText(bro); back = (ImageView) findViewById(R.id.top_view_back); back.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); webView = (WebView) findViewById(R.id.pay_web); webView.setWebViewClient(new WebViewClient() { // 通过webView打开链接,不调用系统浏览器 @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); webView.setInitialScale(25); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setBuiltInZoomControls(true); webSettings.setSupportZoom(true); webView.getSettings().setUseWideViewPort(true); webView.getSettings().setLoadWithOverviewMode(true); webView.loadUrl(url); WebChromeClient webChromeClient = new WebChromeClient() { @Override public void onReceivedTitle(WebView view, String str) { super.onReceivedTitle(view, str); title.setText(str); } }; webView.setWebChromeClient(webChromeClient); web_back = (ImageView) findViewById(R.id.web_back); web_back.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(webView.canGoBack()) { webView.goBack(); } else { } } }); goForward = (ImageView) findViewById(R.id.goForward); goForward.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { webView.goForward(); } }); reload = (ImageView) findViewById(R.id.reload); reload.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { webView.reload(); } }); } }